﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="../../../lib/ligerUI/skins/Aqua/css/ligerui-all.css"
	rel="stylesheet" type="text/css" />

<script src="../../../lib/jquery/jquery-1.3.2.min.js"
	type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/core/base.js"
	type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/plugins/ligerGrid.js"
	type="text/javascript"></script>
<script src="../TreeDeptData.js" type="text/javascript"></script>

<script type="text/javascript">
        var treegrid;
        $(function ()
        {
            treegrid = $("#maingrid").ligerGrid({
                columns: [
                    { display: '部门名', name: 'name', width: 250, align: 'left', frozen: true },
                { display: '部门标示', name: 'id', width: 250, type: 'int', align: 'left' },

                { display: '部门描述', name: 'remark', width: 250, align: 'left' }
                ], width: '100%', pageSizeOptions: [5, 10, 15, 20], height: '97%',
                checkbox:true,title:'头部',
                data: TreeDeptData, alternatingRow: false, tree: { columnName: 'name' }
            }
            );
        });
        function getParent()
        {
            alert(document.getElementById("maingrid|1|1004").innerHTML);
            var row = treegrid.getParent(treegrid.getSelectedRow());
            alert(JSON.stringify(row));
        }
        function getSelected()
        {
            var row = treegrid.getSelectedRow();
            if (!row) { alert('请选择行'); return; }
            alert(JSON.stringify(row));
        }
        function getData()
        {
            var data = treegrid.getData();
            alert(JSON.stringify(data));
        }
        function hasChildren()
        {
            var row = treegrid.getSelectedRowObj();
            alert(treegrid.hasChildren(row));
        }
        function isLeaf()
        {
            var row = treegrid.getSelectedRowObj();
            alert(treegrid.isLeaf(row));
        }
        
    </script>
</head>
<body style="padding: 4px">
	<div>
		<a class="l-button"
			style="width: 120px; float: left; margin-left: 10px;"
			onclick="getParent()">获取父节点</a> <a class="l-button"
			style="width: 120px; float: left; margin-left: 10px;"
			onclick="hasChildren()">是否有子节点</a> <a class="l-button"
			style="width: 120px; float: left; margin-left: 10px;"
			onclick="isLeaf()">是否叶节点节点</a> <a class="l-button"
			style="width: 120px; float: left; margin-left: 10px;"
			onclick="getSelected()">获取选中的值(选择行)</a> <a class="l-button"
			style="width: 120px; float: left; margin-left: 10px;"
			onclick="getData()">获取当前的值</a>

		<div class="l-clear"></div>

	</div>

	<div id="maingrid"></div>
	<div></div>

</body>
</html>
